package maxent.mr.tagger;


import maxent.mr.util.MapSortHDFS;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ToolRunner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author arifn
 */
public class MaxentTaggerMR{

    public static void main(String[]args) throws Exception{

        if(args.length != 4){
            System.err.println("Usage: <tagger-split> <input path> <output path> <model path>");
            System.err.println("tagger-split is defined below:");
            System.err.println("default: tagging using default hadoop splitter");
            System.err.println("nline:tagging using NLine splitter");
            System.exit(-1);
        }

        int res = 0;
        
        if(args[0].equalsIgnoreCase("default")){
            System.out.println("Start tagging using default splitter");
            long startTime = System.currentTimeMillis();
            res = ToolRunner.run(new Configuration(),new TaggerRunner(), args);
            MapSortHDFS.MergeAndSort(args[2]+"-temp", args[2]);
            System.out.println("Job Finished in " + (System.currentTimeMillis()-startTime)/1000.0 + " seconds");      
        }
        else if(args[0].equalsIgnoreCase("nline")){
            System.out.println("Start tagging using nline splitter");
            long startTime = System.currentTimeMillis();
            res = ToolRunner.run(new Configuration(),new TaggerRunnerNLine(), args);
            System.out.println("Job Finished in " + (System.currentTimeMillis()-startTime)/1000.0 + " seconds");            
        }

        System.exit(res);
        
    }
    

}
